<script>
	import Vue from 'vue'
	import appUpdate from 'common/util/appUpdate.js'
	import store from './store/index.js'
	import updateCustomBarInfo from './tuniao-ui/libs/function/updateCustomBarInfo.js'
	export default {
		onLaunch: function(e) {
			console.log('onlaunch',e)
			console.log('onlaunch getLaunchOptionsSync',uni.getLaunchOptionsSync())
			uni.getSystemInfo({
				  success: function(e) {
					  // #ifdef APP-PLUS
					  // 检测升级
					  appUpdate()
					  // #endif
					// #ifndef H5
					
					// 获取手机系统版本
					const system = e.system.toLowerCase()
					const platform = e.platform.toLowerCase()
					// 判断是否为ios设备
					if (platform.indexOf('ios') != -1 && (system.indexOf('ios') != -1 || system.indexOf('macos') != -1)) {
					  Vue.prototype.SystemPlatform = 'apple'
					} else if (platform.indexOf('android') != -1 && (system.indexOf('android') != -1)) {
					  Vue.prototype.SystemPlatform = 'android'
					} else {
					  Vue.prototype.SystemPlatform = 'devtools'
					}
					// #endif
				  }
				})
					
					// 获取设备的状态栏信息和自定义顶栏信息
					// store.dispatch('updateCustomBarInfo')
					updateCustomBarInfo().then((res) => {
					  store.commit('$tStore', {
					    name: 'vuex_status_bar_height',
					    value: res.statusBarHeight
					  })
					  store.commit('$tStore', {
					    name: 'vuex_custom_bar_height',
					    value: res.customBarHeight
					  })
					})
								
					// #ifdef MP-WEIXIN
					//更新检测
					if (wx.canIUse('getUpdateManager')) {
					  const updateManager = wx.getUpdateManager();
					  updateManager && updateManager.onCheckForUpdate((res) => {
						if (res.hasUpdate) {
						  updateManager.onUpdateReady(() => {
							uni.showModal({
							  title: '更新提示',
							  content: '新版本已经准备就绪，是否需要重新启动应用？',
							  success: (res) => {
								if (res.confirm) {
								  uni.clearStorageSync() // 更新完成后刷新storage的数据
								  updateManager.applyUpdate()
								}
							  }
							})
						  })
					
						  updateManager.onUpdateFailed(() => {
							uni.showModal({
							  title: '已有新版本上线',
							  content: '小程序自动更新失败，请删除该小程序后重新搜索打开哟~~~',
								showCancel: false
							})
						  })
						} else {
						  //没有更新
						}
					  })
					} else {
					  uni.showModal({
						title: '提示',
						content: '当前微信版本过低，无法使用该功能，请更新到最新的微信后再重试。',
						showCancel: false
					  })
					}
					// #endif
					
					
					// #ifdef APP-PLUS
					//Vue.prototype.$api.listenTranMsg()
			// 		var info = plus.push.getClientInfo();
			
			// 		/* 5+  push 消息推送 ps:使用:H5+的方式监听，实现推送*/
			// 		plus.push.addEventListener("click", function(msg) {
			// 			console.log("click:" + JSON.stringify(msg));
			// 			console.log(msg.payload);
			// 			console.log(JSON.stringify(msg));
			// 			//这里可以写跳转业务代码
			// 		}, false);
			// 		// 监听在线消息事件    
			// 		plus.push.addEventListener("receive", function(msg) {
			// 			// plus.ui.alert(2);  
			// 			//这里可以写跳转业务代码
			// 			console.log("recevice:" + JSON.stringify(msg))
			// 		}, false);
					// #endif
					
					//Vue.prototype.$api.initLogin()
					
	

		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}

	}
</script>

<style lang="scss">
	@import './tuniao-ui/index.scss';
	@import './tuniao-ui/iconfont.css';
	// @font-face {
	//   font-family: 'pingfang'; /* 自定义字体名称 */
	//   src: url('~@/static/fonts/pingFangChangGui.woff2') format('truetype'); /* 字体文件路径 */
	// }
	
	// @import "~@/static/fonts/pingfangBase64.css";
	.nav-list {
		display: flex;
		flex-wrap: wrap;
		padding: 0px 40upx 0px;
		justify-content: space-between;
	}

	.nav-li {
		padding: 30upx;
		border-radius: 12upx;
		width: 45%;
		margin: 0 2.5% 40upx;
		background-image: url(https://cdn.nlark.com/yuque/0/2019/png/280374/1552996358352-assets/web-upload/cc3b1807-c684-4b83-8f80-80e5b8a6b975.png);
		background-size: cover;
		background-position: center;
		position: relative;
		z-index: 1;
	}

	.nav-li::after {
		content: "";
		position: absolute;
		z-index: -1;
		background-color: inherit;
		width: 100%;
		height: 100%;
		left: 0;
		bottom: -10%;
		border-radius: 10upx;
		opacity: 0.2;
		transform: scale(0.9, 0.9);
	}

	.nav-li.cur {
		color: #fff;
		background: rgb(94, 185, 94);
		box-shadow: 4upx 4upx 6upx rgba(94, 185, 94, 0.4);
	}

	.nav-title {
		font-size: 32upx;
		font-weight: 300;
	}

	.nav-title::first-letter {
		font-size: 40upx;
		margin-right: 4upx;
	}

	.nav-name {
		font-size: 28upx;
		text-transform: Capitalize;
		margin-top: 20upx;
		position: relative;
	}

	.nav-name::before {
		content: "";
		position: absolute;
		display: block;
		width: 40upx;
		height: 6upx;
		background: #fff;
		bottom: 0;
		right: 0;
		opacity: 0.5;
	}

	.nav-name::after {
		content: "";
		position: absolute;
		display: block;
		width: 100upx;
		height: 1px;
		background: #fff;
		bottom: 0;
		right: 40upx;
		opacity: 0.3;
	}

	.nav-name::first-letter {
		font-weight: bold;
		font-size: 36upx;
		margin-right: 1px;
	}

	.nav-li text {
		position: absolute;
		right: 30upx;
		top: 30upx;
		font-size: 52upx;
		width: 60upx;
		height: 60upx;
		text-align: center;
		line-height: 60upx;
	}

	.text-light {
		font-weight: 300;
	}

	@keyframes show {
		0% {
			transform: translateY(-50px);
		}

		60% {
			transform: translateY(40upx);
		}

		100% {
			transform: translateY(0px);
		}
	}

	@-webkit-keyframes show {
		0% {
			transform: translateY(-50px);
		}

		60% {
			transform: translateY(40upx);
		}

		100% {
			transform: translateY(0px);
		}
	}
</style>
